window.onload = function () {
  // 存数据
  const arr=[

    {
    
    "任务编号": "XAHH1234567",
    
    "发货起点": "北京市昌平区回龙观街道西三旗桥东金燕龙写字楼 8877 号",
    
    "收货地址": "河南省郑州市路北区北清路 99 号",
    
    "提货时间": "2022.05.04 13:00"
    
    },
    
    {
    
    "任务编号": "XAHH2345678",
    
    "发货起点": "北京市朝阳区望京南湖南路 18 号院 1 号楼",
    
    "收货地址": "河南省郑州市二七区民主路 23 号",
    
    "提货时间": "2022.05.05 14:00"
    
    },
    
    {
    
    "任务编号": "XAHH3456789",
    
    "发货起点": "北京市海淀区中关村东路 1 号院",
    
    "收货地址": "河南省郑州市中原区建设西路 123 号",
    
    "提货时间": "2022.05.06 15:00"
    
    },
    
  ]
  render()
  function render() {
    const box=document.querySelector('.body')
   
    const Newarr = arr.map((item,index)=> {
      return `
      <div class="tasknum${index}">
      <div class="top">任务编号：${item["任务编号"]}</div>
      <span class="radius1">起</span>
      <div class="verticalline"></div>
      <span class="radius2">止</span>
      <p class="article1">${item["发货起点"]}</p>
      <p class="article2">${item['收货地址']}</p>
      <div class="line"></div>
      <div class="gettime">
        <p class="taketimes">提货时间</p>
        <p class="time">${item['提货时间']}</p>
      </div>
      <span1 class="delay">已延迟</span1>
      <button class="MincommonClickButton">提货</button>
    </div>`
    })
    box.innerHTML=Newarr.join('')
  }
 
  localStorage.setItem('datas', JSON.stringify(arr))
    // 点击任务编号跳转
    // const taskmove=document.querySelector('.body')
    // taskmove.addEventListener('touchstart', (e) => {
    //   if (e.target.tagName === 'DIV') {
    //     location.href='./任务-待提货-详情.html'
    //   }
      // console.log(e.target.tagName);
      // if (e.target.tagName === 'BUTTON') {
      //   e.target.style.backgroundColor = '#FADCD9'
      //   e.target.disabled = true
        
    //   // }
    // })
  // 已完成、待提货跳转
  const finshed = document.querySelector('.goodshead .finshed')
  finshed.addEventListener('touchstart', () => {
    location.href = '任务已完成.html'
  })


  // 页面跳转
  const b = document.querySelector('.common_button .b')
  b.addEventListener('touchstart', function () {
    location.href = 'news&&mission.html'
  })
  const c = document.querySelector('.common_button .c')
  c.addEventListener('touchstart', function () {
    location.href = '我的主页.html'
  })

  // 点击提货已延迟消失
  const minBtn=document.querySelector('button')
  const delay = document.querySelector('.tasknum0 .delay')
  console.log(minBtn);
  minBtn.addEventListener('touchstart', () => {
    minBtn.style.backgroundColor = '#FADCD9'
    minBtn.disabled = true
    delay.style.display='none'
  })
  const topNum = document.querySelector('.tasknum0 .top')
  const nums= 'XAHH1234567'
  topNum.addEventListener('touchstart', () => {
    localStorage.setItem('tasknum',nums)
    location.href = './任务-待提货-详情.html'
    
  })




}

